//
//  HttpHelp.h
//  wowoCircle
//
//  Created by yang on 2019/6/29.
//  Copyright © 2019 com. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// 
@interface HttpHelp : NSObject

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (id)copy NS_UNAVAILABLE; // 没有遵循协议可以不写
- (id)mutableCopy NS_UNAVAILABLE; // 没有遵循协议可以不写

+(instancetype)shareInstance;


/**
 GET数据请求

 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 */
-(void)GETHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error ,NSDictionary * dict,NSMutableArray *data))result;

-(void)GET:(NSString *)URL param:(NSDictionary *)param result:(void(^)(NSDictionary *dict))result;

/**
 GET数据请求,自动解析参数返回解析后的结果

 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 @param model 数据模型
 */
-(void)GETHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error ,NSDictionary * dict,NSMutableArray *data))result withModel:(__nullable Class)model;


/**
 POST数据请求(不解析Model,自动拼接BaseURL)

 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 */
-(void)POSTHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;


/**
 POST数据请求(不解析Model,不不不不不自动拼接BaseURL)
 
 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 */
-(void)POSTHTTPNOBaseURL:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;



/**
 POST数据请求(解析Model,自动拼接BaseURL)

 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 @param model 数据模型
 */
-(void)POSTHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result withModel:(__nullable Class)model;



/**
 POST数据请求(解析Model,不不不不不自动拼接BaseURL)
 
 @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
 @param parameters 参数
 @param result 返回结果，判断顺序 network > finish
 @param model 数据模型
 */
-(void)POSTHTTPNOBaseURL:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result withModel:(__nullable Class)model;



/// POST数据请求V2(解析Model,自动拼接BaseURL)
/// @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
/// @param parameters 参数
/// @param success 数据请求成功的回调
/// @param failure 数据请求失败的回调
/// @param model 数据模型
-(void)POSTHTTPV2:(NSString *)URLString
     parameters:(NSDictionary *)parameters
        success:(void(^)(NSDictionary * dict , NSMutableArray *data))success
        failure:(void(^)(BOOL netErr,NSString *error))failure
        withModel:(__nullable Class)model;


/// POST数据请求V2(不不不不不解析Model,自动拼接BaseURL)
/// @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
/// @param parameters 参数
/// @param success 数据请求成功的回调
/// @param failure 数据请求失败的回调
-(void)POSTHTTPV2:(NSString *)URLString
       parameters:(NSDictionary *)parameters
          success:(void(^)(NSDictionary * dict))success
          failure:(void(^)(BOOL netErr,NSString *error))failure;


/// POST数据请求V2(解析Model,不不不不不不自动拼接BaseURL)
/// @param URLString 域名
/// @param parameters 参数
/// @param success 数据请求成功的回调
/// @param failure 数据请求失败的回调
/// @param model 数据模型
-(void)POSTHTTPNOBaseURLV2:(NSString *)URLString
                parameters:(NSDictionary *)parameters
                   success:(void(^)(NSDictionary * dict , NSMutableArray *data))success
                   failure:(void(^)(BOOL netErr,NSString *error))failure
                 withModel:(__nullable Class)model;

/// POST数据请求 from表单上传图片
/// @param URLString 域名
/// @param parameters 参数
/// 返回结果，判断顺序 network > finish
-(void)POSTHTTPWithFormDataWithUrl:(NSString *)URLString parameters:(NSDictionary *)parameters avatar:(NSArray *)avatar imgName:(NSString *)imgName result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;

/// POST数据请求 from表单上传视频
/// @param URLString 域名
/// @param parameters 参数
/// 返回结果，判断顺序 network > finish
-(void)POSTHTTPToVideoWithFormData:(NSString *)URLString parameters:(NSDictionary *)parameters video:(NSData *)video videoKey:(NSString *)videoKey result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;

/// POST数据请求 下载音视频
/// @param URLString 域名
/// 返回结果，判断顺序 network > finish
- (void)downloadFile:(NSString *)URLString withReportName:(NSString *)reportName success:(void (^)(id item))success progress:(void (^)( double sender))progress exception:(void (^)( id JSON))exception;

///有token的字典
+(NSMutableDictionary*)MakeDictionary;

///没有token的字典
+(NSMutableDictionary*)MakeDictionaryWithNOToken DEPRECATED_MSG_ATTRIBUTE("token已经放在头部,该方法弃用");

///取消网络请求
-(void)cancelRequest;

/// DELETE数据请求V2(不不不不不解析Model,自动拼接BaseURL)
/// @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
/// @param parameters 参数
/// result 返回结果，判断顺序 network > finish
-(void)DELETEHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;

/// PUT数据请求V2(不不不不不解析Model,自动拼接BaseURL)
/// @param URLString 域名后缀,直接传入后缀即可自动拼接BaseURL
/// @param parameters 参数
/// result 返回结果，判断顺序 network > finish
-(void)PUTHTTP:(NSString *)URLString parameters:(NSDictionary *)parameters result:(void(^)(BOOL network, BOOL finish,NSString *error, NSDictionary * dict , NSMutableArray *data))result;

@end

NS_ASSUME_NONNULL_END
